//
//  HDSettingsTableViewController.swift
//  Excited
//
//  Created by X140Yu on 6/18/16.
//  Copyright © 2016 X140Yu. All rights reserved.
//

import UIKit

class HDSettingsTableViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        title = "设置"
    }

    // MARK: - Table view data source

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }

    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
        switch indexPath.row {
//        case 0:
//            Swift.print("意见")
//        case 1:
//            Swift.print("about")
        case 0:
            logout()
            navigationController?.popViewControllerAnimated(true)
        default: break
        }
    }

    func logout() {
        // TODO: - delete all data

        NSNotificationCenter.defaultCenter().postNotificationName(HDUserDidLogoutNotificationKey, object: self)
    }
}
